package mn.usi.spendcontrol.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.TabLayoutPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.cellview.client.CellTable;

public class Partner extends Composite {

	private static PartnerUiBinder uiBinder = GWT.create(PartnerUiBinder.class);

	interface PartnerUiBinder extends UiBinder<Widget, Partner> {
	}
	
	@UiField public static TabLayoutPanel partnerContractPanel;
	@UiField ListBox categoryList;
	@UiField ListBox countryList;
	@UiField ListBox contractTypeList;
	@UiField ListBox validYesNo;
	@UiField ListBox expiredYesNo;
	
	public Partner() {
		initWidget(uiBinder.createAndBindUi(this));
		categoryList.addItem("Бүгд");
		categoryList.addItem("Чадамжтай хэрэглэгч");
		categoryList.addItem("Хэрэглэгч");
		categoryList.addItem("Ажилтан");
		categoryList.addItem("Бэлтгэний түнш");
		
		countryList.addItem("Дотоод");
		countryList.addItem("Гадаад");
		
		contractTypeList.addItem("");
		contractTypeList.addItem("Дотоод");
		contractTypeList.addItem("Гадаад");
		
		validYesNo.addItem("");
		validYesNo.addItem("Тийм");
		validYesNo.addItem("Үгүй");
		
		expiredYesNo.addItem("");
		expiredYesNo.addItem("Тийм");
		expiredYesNo.addItem("Үгүй");
		
		partnerContractPanel.addSelectionHandler(new SelectionHandler<Integer>(){
			public void onSelection(SelectionEvent<Integer> event) {
				if(event.getSelectedItem() == 0)
				{
					History.newItem("partner");
				}
				else if(event.getSelectedItem() == 1)
				{
					History.newItem("contract");
				}
				else
				{
					History.newItem("partner");
				}					
			}			
		});
		
	}

}
